package comm.suger.web.model.dao;

import java.util.List;


import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds;
import comm.suger.web.model.entity.SysUser;
@CacheNamespace(size = 512)
public interface SysUserDao{
	
	//这里的函数名，参数与UserMapper.xml中的id相对应。
	/**
	 * 获取用户
	 * @param userID
	 * @return
	 * 	
	 */
	 SysUser getUserById(@Param("uid") Long id);
	 
	/**
	 * 根据用户名密码
	 * @param id
	 * @return
	 */
	 @Select("select  * from sys_user where  uname = #{uname}  and passwd=#{passwd}")
	SysUser getUser(@Param("uname") String uname , @Param("passwd") String passwd);
	 
	  	/**
	     * 根据id删除文件
	     * @param userID
	     * @return
	     */
     @Select("delete  from sys_user where  uid = #{uid} ")
     int deleteUserById(@Param("uid") Long uid);  
	     
     /**
      * 查询总数
      * @return
      */
     @Select("select count(id) from sys_user ")
     int countAll();
	
    /**
     * 获取所有用户
     * @return
     * 
     */
	 List<SysUser> getUserAll(); 
    /**
     * 
     * @param user
     * @return
     */
     int insertUser(SysUser user); 
    /**
     * 
     * @param user
     * @return
     */
     int updateUserById(SysUser user);  
    
     /**
      * 
      * @param user
      * @param rowBounds
      * @return
      */
     List<SysUser> findUsers(SysUser user,RowBounds rowBounds);
}
